package com.csx.micrometer.invoke.config;

import com.csx.micrometer.invoke.CustomWebMvcTagProvider;
import com.csx.micrometer.invoke.core.outbound.feign.DetectFeignClientCapability;
import com.csx.micrometer.invoke.custom.TagsCustom;
import feign.Capability;
import feign.Feign;
import org.springframework.beans.factory.ObjectProvider;
import org.springframework.boot.actuate.metrics.web.servlet.DefaultWebMvcTagsProvider;
import org.springframework.boot.actuate.metrics.web.servlet.WebMvcTagsContributor;
import org.springframework.boot.actuate.metrics.web.servlet.WebMvcTagsProvider;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import java.util.List;
import java.util.stream.Collectors;

/**
 * @author cuisongxu
 * @date 2022/12/1 15:37
 */
@Configuration
@ConditionalOnClass({Feign.class, Capability.class})
public class FeignOutboundMicrometerConfiguration {

    @Bean
    public Capability detectFeignClientCapability(List<TagsCustom> tagsCustoms) {
        return new DetectFeignClientCapability(tagsCustoms);
    }
}
